<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
  <th:block th:include="include :: header('批量审核回复T')"/>
  <link th:href="@{/ajax/libs/bootstrap-switch/bootstrap-switch.min.css}" rel="stylesheet">
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
  <form class="form-horizontal m" id="form-config-add" name="form-config-add">
    <input type="hidden" name="ids" th:value="${ids}"/>
    <input type="hidden" name="act" id="act"/>
    <div class="col-sm-12" >
      <div class="form-group">
        <label class="col-sm-3 control-label entering-pd">审查意见：</label>
        <div class="col-sm-8">
          <input type="text" id="opinion" name="opinion" class="form-control" >
        </div>
      </div>
    </div>
    <div class="col-sm-12" >
      <div class="form-group">
        <label class="col-sm-3 control-label entering-pd" style="color: red">不通过理由：</label>
        <div class="col-sm-8">
          <input type="text" id="txtReason" name="reason" class="form-control">
        </div>
      </div>
    </div>
    <!--按钮-->
    <div class="col-sm-12" style="display: flex;justify-content: space-around;">
      <div class="form-group">
        <div class="col-sm-12" style="margin:100px 0px 0px 0px">
          <button type="button" class="btn btn-sm btn-success" onclick="passOrNot(1)">通过</button>&nbsp;&nbsp;&nbsp;&nbsp;
          <button type="button" class="btn btn-sm btn-success" onclick="passOrNot(-1)">不通过</button>&nbsp;&nbsp;&nbsp;&nbsp;
          <button type="button" class="btn btn-sm btn-light" onclick="$.modal.close()">关闭</button>
        </div>
      </div>
    </div>
  </form>
</div>
<th:block th:include="include :: footer"/>
<script th:src="@{/ajax/libs/bootstrap-switch/bootstrap-switch.min.js}"></script>
<script type="text/javascript">
  var prefix = ctx + "system/mMailWF/cmnFile";

  $("#form-config-add").validate({
    onkeyup: false,
    focusCleanup: true
  });

  function submitHandler() {
    if ($.validate.form()) {
      var data = $('#form-config-add').serializeArray();
      $.operate.save(prefix + "/dlBatchChkReply", data);
    }
  }

  //通过/不通过
  function passOrNot(flag){
    var act = parseInt(flag);
    $("#act").val(act);
    if(act<1){
      if($("#txtReason").val().length<1){
        $.modal.alertWarning("请输入不通过理由");
        return false;
      }
      $("#opinion").val("不同意");
    }
    else{
      if($("#opinion").val().length<1)
        $("#opinion").val("同意");
    }
    if ($.validate.form()) {
      let url = prefix + "/dlBatchChkReply";
      let data = $('#form-config-add').serializeArray();
      $.operate.save(url,data);
    }
  }

</script>
</body>
</html>
